package sandbox.j2se;

import java.io.ByteArrayInputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Properties;

public class PropertiesString {

    public static void test() {
        final String key = "exec.prep.requisitesUpdated";
        Properties prop = new Properties();
        prop.setProperty(key, "true");
        StringWriter writer = new StringWriter();
        prop.list(new PrintWriter(writer));
        final String propStr = writer.getBuffer().toString();
        System.out.println(propStr);

        Properties prop2 = new Properties();
        try {
            prop2.load(new ByteArrayInputStream(propStr.getBytes()));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        System.out.println(prop2.getProperty(key));
    }
}
